Skip to content

TiledArray code generation#321

Draft
bimalgaudel wants to merge 1 commit intomasterfrom
gaudel/feature/code_generation
Draft

TiledArray code generation#321
bimalgaudel wants to merge 1 commit intomasterfrom
gaudel/feature/code_generation

Conversation

@bimalgaudel
Copy link
Member

@bimalgaudel bimalgaudel commented Jul 9, 2025

Consider the following sum of tensor networks:

$$(A(a_1 x_1) B(x_1 x_2)) C(x_2 b_1) + (A(a_1 y_1) B(y_1 y_2)) D(y_2 b_1) + (C(a_1 x_1) D(x_1 x_2)) E(x_2 b_1)$$

This PR attempts to support TiledArray code generation from it that looks like the following or its equivalent.

// declare the total evaluation result
TArray R;

// first and second term share a common intermediate (A*B)
// evaluate it as part of the first term evaluation

TArray I1;
I1("a1,x2") = A("a1,x1") * B("x1,x2");
R("a1,a2")  = I1("a1,x2") * C("x2,b1");
// done evaluating first term

// reuse the intermediate from first term evaluation
R("a1,a2") += I1("a1,y2") * D("y2,b1");
// done evaluating second term

// third term shares no intermediates
// no need to split up the evaluation like for the first term
R("a1,b1") += (C("a1,x1") * D("x1,x2")) * E("x2,b1");
// done evaluating third term

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants